#include <QVBoxLayout>
#include <QTextEdit>
#include "aispagedocview.h"

AISPageDocView::AISPageDocView(QWidget *parent) :
    QWidget(parent)
{
    initPagesList();
    QVBoxLayout *layout = new QVBoxLayout;
    layout->setContentsMargins(QMargins());
    if (pagesList)
    {
        for (int i = 0; i < pagesList->size(); i ++)
        {
            layout->addWidget(pagesList->at(i));
        }
    }
    setLayout(layout);
}

void AISPageDocView::initPagesList()
{
    pagesList = new QList<QWidget *>;
    if (! pagesList)
    {
        return;
    }

    for (int i = 0; i < 3; i ++)
    {
        QWidget *page = new QTextEdit;
        pagesList->append(page);
    }
}

void AISPageDocView::UninitPageList()
{
    if (! pagesList)
    {
        return;
    }

    while (! pagesList->isEmpty())
    {
        delete pagesList->takeFirst();
    }
}
